Pywikipediabot
This guide hopes to be an easy-to-use introduction to the use of pywikipediabot on Wikia. What is Pywikipediabot? Pywikipedia bot is a set of powerful wiki tools written in Python for performing automated tasks on wikis. It's ran on a command line interface, which seems a lot harder to use for the newcomer than AutoWikiBrowser, but it can do a lot of things that AWB cannot, and the command line interface makes it faster once you're familiar with how it works. Setting up the bot Firstly, you'll need another account on Wikia to act as a bot account. Staff can flag this with a bot flag after you have discussed this with your community (typically on a forum or blog post). A bot flag allows bot edits to be hidden from RecentChanges. Use on your wiki to request a bot flag after your community has discussed this. Instalation python If you're running Mac or Linux, Python should be pre-installed, so you can skip this step. Windows users should go to http://www.python.org/download/ and download and install the latest python with the version number starting with 2''' (at the time of writing this is '''2.7.3). Warning: Pywikipediabot does not support python version 3 - do not use it, and (unless you need it for something else) don't install it. Downloading pywikipediabot Download pywikipedia-nightly.zip from the link and extract somewhere sensible (I extracted mine at C:\Pybot). Technically minded folks might prefer to download the bot via SVN, if you don't know what this means, I'd recommend getting the .zip, it will work just fine.svn checkout http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/ pywikipedia Installing Notepad++ (optional) Although not required, Notepad++ is a free text editor that offers regex find and replace and syntax highlighting which can be a godsend when trying to get a list of pages to delete. Download it here. When editing text that the bot will be working on, set the encoding to UTF-8 on Notepad++, you can do this in the Encoding menu at the top. Generating family and user files #Launch a command line. #*Windows users should press start, click run and type "cmd" and press enter. #*Mac Users, it's apparently in /Applications/Utilities/ - and called Terminal. #*Linux users press alt+f2 and type the name of their favorite terminal emulator (for example "xterm"). #Change the directory in the command line to the directory that you extracted #*On windows, the command is cd, so if you extracted the file to C:\Pybot, then type cd C:\Pybot #*On mac and linux, the command is also cd, File paths are different in Linux, windows uses the \ for file paths, whilst Linux uses / and I have no idea what mac does. #Once you're in the Pywikipediabot directory, run the script generate_family_file.py #*In windows, simply type generate_family_file.py (windows associates the file type .py with python if you installed python correctly). Mac and linux users should type "python generate_family_file.py". If you press the tab key after typing a few letters the terminal should automatically fill out the rest of the file name. Once you've started the script, follow the instructions. #*If you're switching wikis, you'll need to generate a family file for each wiki you want to edit, but there's no need to do this now. #*Feel free to say "no" to the question "Do you want to generate interwiki links?" - you're only going to be working on your local language version of the wiki. #Then run the script generate_user_files.py - choose option 1 then type the number in the list corresponding to the family file you just generated. In the username field, give the name of your bot account. #*Check out this image for more details. Adding an admin account (optional) and logging in If you want to add an admin account (only admins can delete pages), you'll need to edit user-config.py, you can find it in your pywikipediabot directory. Open it in Notepad++. You should see a file similar to this:# -*- coding: utf-8 -*- family = 'community' mylang = 'en' usernames'community''en' = u'Team_Nimrod' If you wanted to add an admin account to this file, add a line below called sysopnames with the same syntax as the usernames line, i.e.sysopnames'community''en' = u'Randomtime' Note that Usernames and sysopnames can be the same name, if you gave your bot account admin rights. If you do this, remember that those admin actions will be hidden from Recent Changes if the bot has a bot flag. Now we're ready to test the bot to see if it works. Go back to your command line and run>login.pyenter the password for your bot account, the script should return Logging in to community:en as Team_Nimrod via API. Should be logged in now Changing wikis If you ever want to change the wiki your bot is working on, run generate_family_file.py for the new wiki and then edit user-config.py to change the family for the old wiki for the new. I.e., if I wanted to change the above file for the CoD wiki (I called the CoD wiki's family file "cod"):# -*- coding: utf-8 -*- family = 'cod' mylang = 'en' usernames'cod''en' = u'Team_Nimrod' sysopnames'cod''en' = u'Randomtime' Now what? Now you've set up the bot, you shouldn't need to touch many of the configuration files again. Pywikipediabot contains a lot of different scripts that can do various tasks on your wiki - you'll have to find the right tool for the job and read up on how to use it. There are plenty of examples on the manual pages at mediawiki.org. As an example of what you can do, I'm going to run you through using category.py to rename a category on my test wiki. I'm going to be moving Category:CoD 3 Achievements to Category:Cod 3 Achievements. #Firslty, I go to the category.py page on the manual, and I read up on how Category.py works. #The manual says that the command I need is "category.py move". I type that into the command line. #I receive the output: Please enter the old name of the category: and Please enter the old name of new category:, and fill it in. #The bot works on it, tells me if there are any errors, and finishes. Updating page Assault Trooper via API Updating page Basic Training (CoD 3) via API Updating page Battlefield Scavenger via API Updating page Big Air via API Updating page Canadian Highlander via API Updating page Polish Tanker via API Updating page Purple Heart (CoD 3) via API Updating page Rifleman (CoD 3) via API Updating page Supply Officer via API Getting Category:CoD 3 Achievements list... The category is now empty, it's moved. The bot's task is done. Simples. If you have any questions, feel free to ask me in the comments.